package com.neutech.base;

import com.neutech.Util.ImageUtils;
import com.neutech.constant.Constant;
import com.neutech.frame.TankFrame;
import com.neutech.tank.EnemyTank;

import java.awt.*;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class TankSummary extends Sprite implements Drawable{

    private Image image;
    private List<Image> tankImages = new ArrayList<>();
    private TankFrame tankFrame;
//    private List<Image> imageList = new ArrayList<>();
//    private transient Map<String,Image> imgMap = new HashMap<>();
    public TankSummary(TankFrame tankFrame) {
        this.tankFrame = tankFrame;
        loadingImg();

    }
    private int index;

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    @Override
    public void draw(Graphics g) {
    //背景图
        g.drawImage(image,0,0,
            Constant.FRAME_WIDTH,Constant.FRAME_HEIGHT,null);



        g.drawImage(tankImages.get(0),Constant.SELECT_TANK_LEFT + Constant.SPRITE_SIZE*2,
            Constant.MARGIN_TOP + Constant.SPRITE_SIZE*5,null);

        /**
         * 上面的文字
         */
        g.setColor(Color.white);
        g.setFont(new Font("楷体",Font.BOLD,28));
        g.drawString("击杀坦克数量如下",150,100);
        g.drawImage(tankImages.get(getIndex()),Constant.SELECT_TANK_LEFT + Constant.SPRITE_SIZE*5,
                    Constant.MARGIN_TOP + Constant.SPRITE_SIZE*5-10,null);
        /**
         * 下面的文字
         */
        g.setColor(Color.white);
        g.setFont(new Font("楷体",Font.BOLD,28));
        g.drawString("按“1" + "返回初始界面",150,300);


    }
    public void loadingImg(){
      image = ImageUtils.getValue("tank_last");
      tankImages.add(ImageUtils.getValue("tank_w_1_4"));//TODO  往里面加图片结算界面
        tankImages.add(ImageUtils.getValue("tank_w_1_4"));//TODO  开始第一个
        tankImages.add(ImageUtils.getValue("number_01"));
      tankImages.add(ImageUtils.getValue("number_02 "));
      tankImages.add(ImageUtils.getValue("number_03"));
      tankImages.add(ImageUtils.getValue("number_04"));
      tankImages.add(ImageUtils.getValue("number_05"));
      tankImages.add(ImageUtils.getValue("number_06"));
      tankImages.add(ImageUtils.getValue("number_07"));
      tankImages.add(ImageUtils.getValue("number_08"));
      tankImages.add(ImageUtils.getValue("number_09"));
      tankImages.add(ImageUtils.getValue("number_10"));
      tankImages.add(ImageUtils.getValue("number_11"));
      tankImages.add(ImageUtils.getValue("number_12"));
      tankImages.add(ImageUtils.getValue("number_13"));
      tankImages.add(ImageUtils.getValue("number_14"));
      tankImages.add(ImageUtils.getValue("number_15"));
      tankImages.add(ImageUtils.getValue("number_16"));
      tankImages.add(ImageUtils.getValue("number_17"));
      tankImages.add(ImageUtils.getValue("number_18"));
      tankImages.add(ImageUtils.getValue("number_19"));
      tankImages.add(ImageUtils.getValue("number_20"));
      tankImages.add(ImageUtils.getValue("number_21"));
      tankImages.add(ImageUtils.getValue("number_22"));
      tankImages.add(ImageUtils.getValue("number_23"));
      tankImages.add(ImageUtils.getValue("number_24"));
      tankImages.add(ImageUtils.getValue("number_25"));
      tankImages.add(ImageUtils.getValue("number_26"));
      tankImages.add(ImageUtils.getValue("number_27"));
      tankImages.add(ImageUtils.getValue("number_28"));
      tankImages.add(ImageUtils.getValue("number_29"));
      tankImages.add(ImageUtils.getValue("number_30"));
      tankImages.add(ImageUtils.getValue("number_31"));
      tankImages.add(ImageUtils.getValue("number_32"));
      tankImages.add(ImageUtils.getValue("number_33"));
      tankImages.add(ImageUtils.getValue("number_34"));
    }

    public void keyPressed(KeyEvent e) {
      if (e.getKeyCode() == KeyEvent.VK_1){
          tankFrame.changeStatus(1);
      }
    }

    @Override
    public Rectangle getRectangle() {
        return null;
    }


    /**
     * 绘制文字
     */



}
